#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
char arr[20][20];
int n;
int i;

//将中缀表达式变成后缀表达式
//规则：操作数直接入表达式，操作符入栈，如果优先级大于栈顶，那就前面的还不能算，直接入栈，如果优先级小于等于栈顶，那前面的开始算
//如果遇右括号把操作符全出栈，遇左括号开辟新栈帧


//后缀式的计算：创个栈，数就直接入栈，符就从栈中取两个数运算后将结果入栈，重复操作
typedef struct
{
	char _a[20][20];
	int _sz;
}stack;


void push(stack* pst, char s)
{
	pst->_a[pst->_sz][0] = s;
	pst->_a[pst->_sz][1] = 0;
	pst->_sz++;
}

void pop(stack* pst)
{
	pst->_sz--;
}

char* top(stack* pst)
{
	return pst->_a[pst->_sz - 1];
}
bool empty(stack* pst)
{
	return pst->_sz == 0;
}

int prior(char s[])
{
	if (!strcmp(s, "*") || !strcmp(s, "/"))
	{
		return 2;
	}
	return 1;

}


void dfs(char s[],  int len)
{
	stack st;
	st._sz = 0;
	while (i < len)
	{
		if (isdigit(s[i]))
		{
			char tmp[20] = { 0 };
			int m = 0;
			while (i < len && isdigit(s[i]))
			{
				tmp[m++] = s[i++];
			}
			strcpy(arr[n++], tmp);
		}
		else if (s[i] == '(')
		{
			i++;
			dfs(s, len);
		}
		else if (s[i] == ')')
		{
			while (!empty(&st))
			{
				strcpy(arr[n++], top(&st));
				pop(&st);
			}
			i++;
			return;

		}
		else
		{
			char tmp[20] = { 0 };
			tmp[0] = s[i];
			if (empty(&st) || prior(tmp) > prior(top(&st)))
			{
				push(&st, s[i]);
			}
			else
			{
				while (!empty(&st) && prior(tmp) <= prior(top(&st)))
				{
					strcpy(arr[n++], top(&st));
					pop(&st);
				}

				push(&st, s[i]);



			}
			i++;
		}

	}

	while (!empty(&st))
	{
		strcpy(arr[n++], top(&st));
		pop(&st);
	}





}

void Print()
{
	for (int j = 0;j < n;j++)
	{
		printf("%s ", arr[j]);
	}
	printf("\n");
}


int compute()
{
	int st[20];
	int sz = 0;
	for (int j = 0;j < n;j++)
	{
		if (!strcmp(arr[j],"*") || !strcmp(arr[j], "/") || !strcmp(arr[j], "+") || !strcmp(arr[j], "-")  )
		{
			int t1 = st[sz-1];
			sz--;
			int t2 = st[sz - 1];
			sz--;
			if (!strcmp(arr[j], "*"))
			{
				st[sz++] = t1 * t2;
			}
			else if (!strcmp(arr[j], "/"))
			{
				st[sz++] =  t2/t1;
			}
			else if (!strcmp(arr[j], "+"))
			{
				st[sz++] = t2 + t1;
			}
			else if (!strcmp(arr[j], "-"))
			{
				st[sz++] = t2 - t1;
			}
			
		}
		else
		{
			st[sz++] = atoi(arr[j]);
		}
	}
	return st[0];
}
int main()
{

	char s[100];
	while (scanf("%s", s) != EOF && strcmp(s,"="))
	{
		n = 0;
		int lenth = strlen(s);
		i = 0;
		dfs(s, lenth);
		//Print();
		printf("%d\n\n", compute());




	}
	return 0;
}